package guda.house.biz.form.rule;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.EstateRuleDO;

import javax.validation.constraints.NotNull;

/**
 * Created by well on 15/11/11.
 */
public class EstateRuleEditForm extends EstateRuleForm{

    @NotNull(message = "不能为空")
    private Long ruleId;

    public void initForm(EstateRuleDO estateRuleDO){
        setRuleId(estateRuleDO.getRuleId());
        setRuleStatus(estateRuleDO.getRuleStatus());
        setVarId(estateRuleDO.getVarId());
        setFeeUnit(PriceUtil.formatCNY(estateRuleDO.getFeeUnit()));
        setVillageId(estateRuleDO.getVillageId());
    }

    public Long getRuleId() {
        return ruleId;
    }

    public void setRuleId(Long ruleId) {
        this.ruleId = ruleId;
    }

    public EstateRuleDO toDO(){
        EstateRuleDO estateRuleDO = super.toDO();
        estateRuleDO.setRuleId(ruleId);
        return estateRuleDO;
    }
}
